<html>
<head><meta charset="utf-8"><title>Dead Store Elimination · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html">Dead Store Elimination</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="198596821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Dead%20Store%20Elimination/near/198596821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html#198596821">(May 24 2020 at 19:42)</a>:</h4>
<p>Do we have a pass that can eliminate stores that are never read? Const prop can leave a lot of those behind when it runs.</p>



<a name="198596901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Dead%20Store%20Elimination/near/198596901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html#198596901">(May 24 2020 at 19:45)</a>:</h4>
<p><code>SimplifyLocals</code> does a rather naive form of DSE</p>



<a name="198596971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Dead%20Store%20Elimination/near/198596971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html#198596971">(May 24 2020 at 19:47)</a>:</h4>
<p>Specifically it removes stores to locals where the local is never read, rather than where the stored value is never read.</p>



<a name="198597081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Dead%20Store%20Elimination/near/198597081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html#198597081">(May 24 2020 at 19:48)</a>:</h4>
<p>Ah I see, that should already help</p>



<a name="198601990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Dead%20Store%20Elimination/near/198601990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html#198601990">(May 24 2020 at 21:52)</a>:</h4>
<p>More robust DSE is one of the things I wanted to implement now that intrablock liveness is easy to compute.</p>



<a name="198602950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Dead%20Store%20Elimination/near/198602950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html#198602950">(May 24 2020 at 22:20)</a>:</h4>
<p>I think I'll work on that next week.</p>



<a name="198608305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Dead%20Store%20Elimination/near/198608305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html#198608305">(May 25 2020 at 01:14)</a>:</h4>
<p>Somewhat related, I'm working on being able to remove locals that are only used for debug info while still preserving the debug info data.</p>



<a name="204696357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Dead%20Store%20Elimination/near/204696357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Simon Vandel Sillesen <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html#204696357">(Jul 22 2020 at 17:24)</a>:</h4>
<p>Hi! I played around with the playground, looking for simple MIR optimizations. In this code <a href="https://play.rust-lang.org/?version=nightly&amp;mode=release&amp;edition=2018&amp;gist=5e51319bc039ba93e4006ce775988439">https://play.rust-lang.org/?version=nightly&amp;mode=release&amp;edition=2018&amp;gist=5e51319bc039ba93e4006ce775988439</a> "x" is const so no side effects and completely dead. It is however not removed. </p>
<p>I'm reviving this topic as that seems to be the "more robust DSE" being talked about. Any progress on that <span class="user-mention" data-user-id="118594">@ecstatic-morse</span> , <span class="user-mention" data-user-id="125250">@Wesley Wiser</span> ? If not, I could be interested in giving a (simple) pass a shot. Would this fit inside SimplifyLocals, or should it be pulled out into a separate dead-code-elimination pass?</p>



<a name="204696784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Dead%20Store%20Elimination/near/204696784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html#204696784">(Jul 22 2020 at 17:27)</a>:</h4>
<p>Hi <span class="user-mention" data-user-id="139182">@Simon Vandel Sillesen</span>! I've actually got a PR up that's waiting to merge that resolves that <a href="https://github.com/rust-lang/rust/pull/73210">https://github.com/rust-lang/rust/pull/73210</a></p>



<a name="204696869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Dead%20Store%20Elimination/near/204696869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html#204696869">(Jul 22 2020 at 17:28)</a>:</h4>
<p>(The thing that's causing <code>x</code> to hang around is because it's being used by debuginfo)</p>



<a name="204714755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Dead%20Store%20Elimination/near/204714755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Simon Vandel Sillesen <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html#204714755">(Jul 22 2020 at 19:57)</a>:</h4>
<p>Alright, that sounds good!</p>



<a name="204714945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Dead%20Store%20Elimination/near/204714945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Dead.20Store.20Elimination.html#204714945">(Jul 22 2020 at 19:59)</a>:</h4>
<p>If you're looking for an optimization to work on, I think <span class="user-mention" data-user-id="124288">@oli</span>  has some "beginner" ones in mind <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>